package com.rxh.service.impl;

import com.rxh.mapper.core.*;
import com.rxh.mapper.merchant.MerchantGoodsMapper;
import com.rxh.mapper.risk.RiskOrderTrackMapper;
import com.rxh.pojo.Result;
import com.rxh.pojo.core.*;
import com.rxh.pojo.merchant.MerchantGoods;
import com.rxh.pojo.risk.RiskOrderTrack;
import com.rxh.service.AcquirerService;
import com.rxh.service.PaymentRecordService;
import com.rxh.service.core.CoreOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: 陈俊雄
 * Date: 2018/9/12
 * Time: 9:56
 * Project: Management
 * Package: com.rxh.service.impl
 */
@Service
public class PaymentRecordServiceImpl implements PaymentRecordService {
    @Autowired
    private RiskOrderTrackMapper orderTrackMapper;
    @Autowired
    private CoreOrderMapper orderMapper;
    @Autowired
    private CoreMerchantOrderMapper merchantOrderMapper;
    @Autowired
    private CoreMerchantOrderRmbMapper merchantOrderRmbMapper;
    @Autowired
    private CoreOrderDetailMapper orderDetailMapper;
    @Autowired
    private CoreCardholderMapper cardholderMapper;
    @Autowired
    private CoreCardDetailMapper cardDetailMapper;
    @Autowired
    private ChannelOrderInfoMapper channelOrderInfoMapper;
    @Autowired
    private CoreOrderGoodsMapper orderGoodsMapper;
    @Autowired
    private MerchantGoodsMapper merchantGoodsMapper;
    @Autowired
    private CoreOrderService orderService;
    @Autowired
    private AcquirerService acquirerService;

    @Override
    public int insertOrderTrack(RiskOrderTrack orderTrack) {
        return orderTrackMapper.insertSelective(orderTrack);
    }

    @Override
    public Result<CoreOrder> insertCoreOrder(CoreOrder order) {
        return orderService.insertSelective(order);
    }

    @Override
    public int insertMerchantOrder(CoreMerchantOrder merchantOrder) {
        return merchantOrderMapper.insertSelective(merchantOrder);
    }

    @Override
    public int insertMerchantOrderRmb(CoreMerchantOrderRmb merchantOrderRmb) {
        return merchantOrderRmbMapper.insertSelective(merchantOrderRmb);
    }

    @Override
    public int insertOrderDetail(CoreOrderDetail orderDetail) {
        return orderDetailMapper.insertSelective(orderDetail);
    }

    @Override
    public int insertCardholder(CoreCardholder cardholder) {
        return cardholderMapper.insertSelective(cardholder);
    }

    @Override
    public int insertCardDetail(CoreCardDetail cardDetail) {
        return cardDetailMapper.insertSelective(cardDetail);
    }

    @Override
    public int insertChannelOrderInfo(ChannelOrderInfo channelOrderInfo) {
        return channelOrderInfoMapper.insertSelective(channelOrderInfo);
    }

    @Override
    public int insertOrderGoods(List<CoreOrderGoods> orderGoods) {
        return orderGoodsMapper.insertCoreOrderGoodsList(orderGoods);
    }

    @Override
    public int insertMerchantGoods(List<MerchantGoods> merchantGoods) {
        return merchantGoodsMapper.insertMerchantGoodsList(merchantGoods);
    }

    @Override
    public List<MerchantGoods> selectMerchantGoodsBy() {
        return null;
    }

    @Override
    public int updateOrderByPrimaryKeySelective(CoreOrder order) {
        return orderMapper.updateByPrimaryKeySelective(order);
    }

    public CoreCardholder selectCardholderByOrderIdAnd(CoreCardholder cardholder) {
        return cardholderMapper.selectByParam(cardholder);
    }
}
